# -*- coding: utf-8 -*- 
import os
import tpllibs
import web
from web.contrib.template import render_jinja
__all__ = [
    "result", "wwwdir", 'myFilters', "myrender"
]

wwwdir = os.path.dirname(__file__).replace("libs", '')

#模板
def myrender( ** arg):
    tpldir = arg.pop("tpldir", [])
    encoding = arg.pop("encoding", [])
    myFilters = arg.pop("myFilters", {})
    render = render_jinja(
                        
                          os.path.join(wwwdir, tpldir),
                          encoding="utf-8",
                          )

    if myFilters:
        render._lookup.filters.update(myFilters)
    return render
myFilters = {"seturl":tpllibs.seturl,"urlencode":tpllibs.urlencode, "htmlInput":tpllibs.htmlInput,  "htmlsub":tpllibs.htmlsub, "htmlSelect":tpllibs.htmlSelect,"htmleditor":tpllibs.htmleditor, "timeformat":tpllibs.timeformat}

result = dict() #初始化结果变量集



